package com.sdx.console.promote.service;

import java.util.List;

import org.beetl.sql.core.engine.PageQuery;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.promote.dao.PromoteLinkDao;
import com.sdx.console.promote.entity.PromoteLink;
import com.ibeetl.admin.core.service.BaseService;

/**
 * 推广链接 Service
 */

@Service
@Transactional
public class PromoteLinkService extends BaseService<PromoteLink>{

    @Resource
	private PromoteLinkDao promoteLinkDao;

    public PageQuery<PromoteLink>queryByCondition(PageQuery query){
        PageQuery ret =  promoteLinkDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelPromoteLink(List<String> ids){
        try {
            promoteLinkDao.batchDelPromoteLinkByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除推广链接失败", e);
        }
    }

	public List<PromoteLink> all() {
		return promoteLinkDao.all();
		}

	public List<PromoteLink> selectValid (Integer tenantId){
        return promoteLinkDao.selectValid(tenantId);
    }
}